﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;

using VPBS.Common;

namespace VPBS.SqlClient.DAL
{
    public class TnAdjustRateDAL
    {
        /// <summary>
        /// Lay danh sach danh muc chung khoan cua tung tai khoan
        /// </summary>
        /// <param ></param>
        /// <returns>DataSet Get_IMCustomer</returns>
        public static decimal Get_AdjustRate(string custcode, string custacct)
        {
            try
            {
                string command =
                    @"select top(1) * from TN_ADJUST_RATE where effective_date <= getdate() 
and custcode='" + custcode +
                    "' and custacct='" + custacct + "' ";
                DataSet ds = SqlHelper.ExecuteDataset(ConnectStringHelper.PortalConnectionString, CommandType.Text,
                                                      command);
                if (ds != null && ds.Tables.Count > 0)
                    return decimal.Parse(ds.Tables[0].Rows[0]["adjust_rate"].ToString());
                return 100m;
            }
            catch (Exception ex)
            {
                //Logger.Error(typeof(Get_IMCustomer), ex);
                return 100m;
            }
        }
    }
}
